<?php

namespace catchAdmin\pc\tables;

use catchAdmin\pc\tables\forms\Factory;
use catcher\CatchTable;
use catcher\library\table\Actions;
use catcher\library\table\HeaderItem;
use catcher\library\table\Search;

class UserCompany extends CatchTable
{

    public function Table()
    {
        return $this
            ->getTable('userCompany')
            ->header([
//                HeaderItem::label('')->selection(),
                HeaderItem::label('手机号')
                    ->prop('wechat_user_phone')
                    ->width('200'),
                HeaderItem::label('推广人')
                    ->prop('parent_name')
                    ->width('200'),
                HeaderItem::label('公司类型')
                    ->prop('company_type_name')
                    ->width('100'),
                HeaderItem::label('公司名称')
                    ->prop('company_name'),
//                HeaderItem::label('法人姓名')->prop('person_realname'),
//                HeaderItem::label('法人手机号')->prop('person_mobile'),
//                HeaderItem::label('联系人姓名')->prop('linkman_realname'),
//                HeaderItem::label('联系人手机号')->prop('linkman_mobile'),
                HeaderItem::label('城市')
                    ->prop('city_name')
                    ->width('200'),
                HeaderItem::label('申请时间')
                    ->prop('apply_time')
                    ->width('200'),
                HeaderItem::label('审核状态')
                    ->prop('company_status_name')
                    ->width('150'),
                HeaderItem::label('审核时间')
                    ->prop('audit_time_show')
                    ->width('200'),
                HeaderItem::label('操作')
                    ->actions([
//                    Actions::update(),
//                    Actions::delete(),
                        Actions::normal('查看位置', 'zz6', 'viewaddress', 'el-icon-s-tools'),
                        Actions::normal('查看详情', 'zz3', 'tongguoshenhe', 'el-icon-s-tools'),
                        Actions::normal('审核记录', 'zz4', 'shlog', 'el-icon-s-order'),
                        Actions::normal('推广信息', 'zz5', 'tginfo', 'el-icon-s-grid')
                            ->hiddenFiled('sh'),

                    ])
                    ->width(500),
            ])
            ->withSearch([
                Search::label('企业类型')
                    ->select('company_type', '选择企业类型', tableSelectArray((new \catchAdmin\model\UserCompany())->getCompanyTypeNameList()))
                    ->style(['width' => '100px'])
                    ->clearable(true),
                Search::label('公司名称')
                    ->text('company_name', '公司名称')
                    ->style(['width' => '250px'])
                    ->clearable(true),
//                Search::label('法人姓名')->text('person_realname', '法人姓名')->size('10'),
//                Search::label('法人手机号')->text('person_mobile', '法人手机号')->size('10'),
//                Search::label('联系人姓名')->text('linkman_realname', '联系人姓名')->size('10'),
//                Search::label('联系人手机号')->text('linkman_mobile', '联系人手机号')->size('10'),
                Search::label('审核状态')
                    ->select('company_status', '选择审核状态', tableSelectArray((new \catchAdmin\model\UserCompany())->getCompanyStatusNameList()))
                    ->style(['width' => '100px'])
                    ->clearable(true),
            ])
            ->selectionChange()
            ->withApiRoute('userCompany')
            ->withActions([
//                Actions::create(),
//                Actions::export(),
            ])
            ->render();
    }


    public function form()
    {
        return Factory::create('userCompany');
    }

}
